<?php
class Admincp_model extends MY_Model {

	private $table = 'admin_user';
	function checkLogin($user = '',$password = ''){
		$this->db->select('*');
		$this->db->where('username', $user);
		$this->db->where('password', $password);
		$this->db->where('status',1);
		$query = $this->db->get(PREFIX.$this->table);
		$result = $query->result();
		
		if($result){
			return $result;
		}else{
			return false;
		}
	}
	
	public function getInformation($username = '')
	{
		$this->db->select('*');
		$this->db->where('username',$username);
		$this->db->where('status',1);
		$query = $this->db->get(PREFIX.$this->table);
		$result = $query->result();
		
		if($result)
		{
			return $result;
		}else{
			return false;
		}
	}
	
	/*
	*
	*	Function checkExists()
	*	Des: Kiem tra su ton tai cua user
	*/
	
	function checkExists($input = '',$field = '')
	{
		$this->db->select('id');
		$this->db->where("{$input}",$field);
		$query = $this->db->get(PREFIX.$this->table);
		
		$result = $query->result();
		if($result)
		{
			return $result;
		}else{
			return false;
		}
	}
}